import { FileType } from "../models";
import {
  FullAuditedAggregateRoot,
  PagedAndSortedResultRequestDto,
} from "../types";

/*
 * @Description:
 * @Author: 胡涛
 * @Date: 2023-10-12 22:51:27
 * @LastEditors: 胡涛
 * @LastEditTime: 2023-10-18 22:50:39
 */
export interface BucketDto extends FullAuditedAggregateRoot<string> {
  id: string;
  isPublic: boolean;
  status: boolean;
  description: string;
}
export interface GetBucketInputDto extends PagedAndSortedResultRequestDto {
  Name: string;
  Status: boolean;
}

export interface DirResourceDto extends FullAuditedAggregateRoot<string> {
  parentId: string;
  bucketName: string;
  dirName: string;
  dirPath: string;
  folderIcon: string;
  description: string;
  remarks: string;
  children?: Array<DirResourceDto>;
}

export interface GetDirResourceInputDto extends PagedAndSortedResultRequestDto {
  Name: string;
  BucketName: FileType;
  ParentId: string;
}

export interface FileResourceDto extends FullAuditedAggregateRoot<string> {
  fileName: string;
  filePath: string;
  extension: string;
  bucketName: string;
  dirPath: string;
  fileType: FileType;
  tags: Array<string>;
  isPublic: boolean;
  fileSize: number;
  duration: number;
  remarks: string;
}

export interface GetFileResourceInputDto
  extends PagedAndSortedResultRequestDto {
  Name: string;
  Type: FileType;
  DirPath: string;
  StartTime: string;
  EndTime: string;
  Extension: string;
}

/**
 * 上传文件请求参数类
 */
export interface UploadFileResourceInputDto {
  file: any;
  bucketName: string;
  dir?: string;
  fileName: string;
  dirId?: string;
  isPublic: boolean;
}

export interface AttachmentDto extends FullAuditedAggregateRoot<string> {
  bussinessType: string;
  businessId: string;
  groupName: string;
  name: string;
  fileId: string;
}

export interface GetAttachmentInputDto extends PagedAndSortedResultRequestDto {
  BussinessType: string;
  GroupName: string;
  BusinessId: string;
}

export interface AttachmentConfigDto extends FullAuditedAggregateRoot<string> {
  bussinessType: string;
  groupName: string;
  defineFields: Array<AttachementFieldDto>;
  maxLength: number;
}

export interface AttachementFieldDto {
  name: string;
  caption: string;
  required: boolean;
  valueType: FieldValueType;
  inputType: FieldInputType;
  systemType: SystemValueType;
  defaultValue: string;
  inputProps: Record<string, any>;
}

export interface GetAttachmentConfigInputDto
  extends PagedAndSortedResultRequestDto {
  bussinessType: string;
  groupName: string;
}

export enum FieldValueType {
  String = 1,
  Integer = 2,
  Float = 4,
  DateTime = 8,
  Boolean = 16,
  Guid = 32,
}

export enum FieldInputType {
  System = 1,
  TextInput = 2,
  DictionarySelect = 4,
  UserSelect = 8,
  RegionSelect = 16,
  EnumSelect = 32,
  CustomSelect = 64,
}

export enum SystemValueType {
  SystemTime = 1,
  CurrentUserId = 2,
  CustomValue = 4,
}
